<html xmlns:color="http://www.w3.org/1999/xhtml">
<head>
	<!-- 页面meta -->
	<meta charset="utf-8">
	<meta http-equiv="Content-Type" content="IE=edge">
	<title>权限管理</title>
	<!-- Tell the browser to be responsive to screen width -->
	<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
	<link rel="stylesheet" href="../static/plugins/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" href="../static/plugins/adminLTE/css/AdminLTE.css">
	<link rel="stylesheet" href="../static/plugins/adminLTE/css/skins/_all-skins.min.css">
	<link rel="stylesheet" href="../static/css/style.css">
	<link rel="stylesheet" href="../static/plugins/angularjs/toaster.min.css">
	<script src="../static/plugins/jQuery/jquery-2.2.3.min.js"></script>
	<script src="../static/plugins/bootstrap/js/bootstrap.min.js"></script>

	<script type="text/javascript" src="../static/plugins/angularjs/angular.min.js"></script>
	<script type="text/javascript" src="../static/plugins/angularjs/angular-animate.min.js"></script>
	<script type="text/javascript" src="../static/plugins/angularjs/toaster.min.js"></script>

	<style>
		.tab{
			margin-left:300px;
		}
		.box-body{
			text-align:left;
		}
		.top{
			float: right;
			padding-right: 5px;
		}
	</style>
	<style>
		.btn-group2{
			float: left;
			padding-left: 5px;
		}
	</style>
	<style>
		.btn-group{

		}
	</style>
	<script type="text/javascript">
        var app = angular.module("drugsCatalog",[]);
        app.controller("drugCheckController",function ($scope,$http) {

            $scope.model = {
                "administrative": "",
                "followGrowp": "",
                "date": "",
                "patientNumber": "",
                "name": "",
                "sex":"",
                "age":"",
                "nextDate":"",
                "state":""
            };
            $scope.pages = function (pageNum,pageSize) {

                if (pageNum == null || pageNum == "") {
                    pageNum=$("#pagenum").val();
                }
                if (pageSize == null || pageSize==""){
                    var myselect=document.getElementById("pageSize");
                    var index = myselect.selectedIndex;
                    var optionsval = myselect.options[index].value;
                    pageSize=optionsval;
                }
                $scope.model.pageNum = pageNum;
                $scope.model.pageSize = pageSize;
                $http({
                    url: "selectDrugCatalog",
                    method: "post",
                    data: $scope.model,
                    dataType: "json",
                    headers: {'Content-Type': 'application/x-www-form-urlencoded'},
                    transformRequest: function (obj) { //在请求之前对data传参进行格式转换
                        var str = [];
                        for (var p in obj) {
                            str.push(p + "=" + obj[p]);
                        }
                        return str.join("&");
                    }
                }).success(function (data) {//请求成功并返回数据
                    $scope.pageUtil = data;
                })
            }
        });
        function fatherChecked() {
            //定义父选择器
            var father = $("[name=fathercheck]");
            //定义子选择器
            var children = $("[name=childrencheck]");
            //如果选中父选择器
            if(father.prop("checked")){
                //则子选择器全部循环遍历选中
                for (var i=0;i<children.length;i++){
                    //childre[i].checked = true;//js写法
                    //给子选择器选择属性赋值为true
                    $(children[i]).prop("checked",true);
                }
            }else{
                //否则未选中父选择器则遍历循环子选择器
                for(var i=0;i<children.length;i++){
                    //给子选择器选择属性赋值为false
                    $(children[i]).prop("checked",false);
                }
            }
        }

        function childrenChecked(){
            var father = $("[name=fathercheck]");
            var children = $("[name=childrencheck]");
            var bool = true;
            for(var i=0;i<children.length;i++){
                //如果子选择器没被选择 bool为false
                if(!children[i].checked){
                    bool=false;
                    break;
                }
            }
            father.prop("checked",bool);
        }
        function removeBeach() {
            var children = $("[name=childrencheck]");
            var array = new Array;
            var b = false;
            for (var i = 0;i < children.length;i++) {
                if (children[i].checked) {
                    b = true;
                    console.log($(children[i]).val());
                    array.push(children[i].value);
                }
            }
            if (b) {
                $.ajax({
                    url: "updateIsDel",
                    type: "post",
                    data: {
                        ids: array
                    },
                    dataType: "json",
                    success: function (data) {
                        if (data) {
                            alert("提交成功")
                            history.go();
                        } else alert("提交失败")
                    }
                })
            } else {
                alert("请选择要提交的数据")
            }
        }
        function exportCatalogAll() {
            window.location.href = "exportCatalogAll";
        }
	</script>
</head>
<body class="hold-transition skin-red sidebar-mini" ng-app="drugsCatalog" ng-controller="drugCheckController" ng-init="pages()">
<!-- .box-body -->
<toaster-container toaster-options="{'time-out': 1000,'position-class':'toast-top-center'}"></toaster-container>

<div class="box-header with-border" style="background-color: #00BFFF;color:#FFFFFF;width: 1470px">
	<h3 class="box-title">随访组分组管理</h3>
	<div class="top">
		<h5 class="setting">
			<a href="NewGroup.html" style="background-color: #00BFFF;color:#FFFFFF;">新建随访组</a>
			<a href="" style="background-color: #00BFFF;color:#FFFFFF;">随访进度管理</a>
			<a href="" style="background-color: #00BFFF;color:#FFFFFF;">数据复核</a>
			<a href="" style="background-color: #00BFFF;color:#FFFFFF;">分组管理</a>
			<a href="" style="background-color: #00BFFF;color:#FFFFFF;">系统设置</a>
			<a href="" style="background-color: #00BFFF;color:#FFFFFF;">账号设置</a>
		</h5>
	</div>
</div>
<div class="box-body">
	<div class="has-feedback">
		<div class="btn-group2">
			<button type="button" class="btn btn-xs" style="background-color: #00BFFF;color:#FFFFFF">返回随访组</button>
		</div>
		<div style="text-align: center;padding-top: 50px;margin-left: 120px;background: #ffffff">
			<table class="tab">
				<tr class="col-lg-6">
					<td width="100px"><span>角色名称:</span></td>
					<td><input padding-center; ng-model="model.drugsId" style="width: 150px"></td>
				</tr>
				<tr class="col-lg-6">
					<td width="100px"><span>备注:</span></td>
					<td><input padding-center; ng-model="model.serialNumber"></td>
				</tr>
			</table>
		</div>
		<div style="text-align: center;padding-top: 10px">
			<button class="btn btn-default"ng-click="pages()" style="background-color: #00BFFF;color:#FFFFFF">查询</button>
		</div>
	</div>
</div>
<div class="box-body">
	<!-- 数据表格 -->
	<div class="table-box">
		<!-- 数据表格 -->
		<div class="table-box">
			<!--工具栏-->
			<div class="pull-left">
				<div class="form-group form-inline">
					<div class="btn-group">
						<!--onClick点击事件触发调用方法-->
						<button type="button" class="btn btn-xs" style="background-color: #00BFFF;color:#FFFFFF">新增</button>
						<button type="button" class="btn btn-xs" style="background-color: #00BFFF;color:#FFFFFF">修改</button>
						<button type="button" class="btn btn-xs" style="background-color:#00BFFF;color:#FFFFFF">删除</button>
					</div>
				</div>
			</div>
		</div>
		<!--工具栏/-->
		<!--数据列表-->
		<table id="dataList" class="table table-bordered table-striped table-hover dataTable" style="background-color: #00BFFF;color:#FFFFFF">
			<thead>
			<tr>
				<th class="sorting_asc"><input type="checkbox" id="fathercheck" onclick="fatherChecked()" name="fathercheck"/></th>
				<th class="sorting_asc">角色级别</th>
				<th class="sorting_asc">角色名称</th>
				<th class="sorting_asc">权限用户设定</th>
				<th class="sorting">用户</th>
				<th class="sorting">权限</th>
			</tr>
			</thead>
			<tbody>
			<tr ng-repeat="follow in pageUtil.result">
				<td><input type="checkbox" id="childrencheck" onclick="childrenChecked()" ng-value="check.id" name="childrencheck"/></td>
				<td ng-bind="follow.patientNumber"></td>
				<td>{{follow.followGrowp}}</td>
				<td>{{follow.name}}</td>
				<td>{{follow.sex}}</td>
				<td>{{follow.age}}</td>
				<td>{{follow.date}}</td>
				<td>{{follow.nextDate}}</td>
				<td>{{follow.state}}</td>
				<td>
					<button type="button" ng-click="findOne()" class="btn bg-olive btn-xs" data-toggle="modal"data-target="#editModal1">
						查看
					</button>
				</td>
			</tr>
			</tbody>
		</table>
		<!--数据列表/-->
		<!--分页工具条展示-->
		<div>
			<button type="button" ng-click="pages(1)" class="btn btn-xs" style="background-color: #00BFFF;color:#FFFFFF">首页</button>
			<button type="button" ng-click="pages(pageUtil.prePage)" class="btn btn-xs" style="background-color: #00BFFF;color:#FFFFFF">上一页</button>

			<button type="button" ng-click="pages(pageUtil.nextPage)" class="btn btn-xs" style="background-color: #00BFFF;color:#FFFFFF">下一页</button>
			<button type="button" ng-click="pages(pageUtil.pages)" class="btn btn-xs" style="background-color: #00BFFF;color:#FFFFFF">尾页</button>
			<td>分页页数</td>
			<td>
				<select id="pageSize" type="text" ng-click="pages()">
					<option value="5">5</option>
					<option value="10">10</option>
					<option value="15">15</option>
					<option value="20">20</option>
				</select>
			</td>
			<td>转到</td>
			<td><input id="pagenum" type="text"style="width:42px;height:22.44px"; value="1" ng-click="pages()"/></td>
			<td><button type="button" ng-click="pages()"class="btn btn-xs" style="background-color: #00BFFF;color:#FFFFFF">GO!</button></td>
			<td>共{{pageUtil.total}}条数据</td>
		</div>
	</div>
	<!-- 数据表格 /-->
</div>
</div>
</body>
</html>